<div class="toolcy">
	<div class="tooltop">
        <div class="toolname">
            <h2>常用工具</h2>
        </div>
        <div class="optionbox">
			<ul>
            	<li class="toolon"><a href="#">国际运费表</a></li>
                <li><a href="/tool/visiting">上门取货费用试算</a></li>
                <li><a href="/tool/track">物流跟踪查询</a></li>
                <li><a href="/tool/size">尺码换算</a></li>
                <li><a href="/tool/rate">汇率换算</a></li>
            </ul>
        </div>
    </div>
</div>

<div class="toolbox">
    <div class="ssbox">
    	<div class="sstop">
        	<div class="ssname">
                <h1>国际运费计算器</h1>
                <p>查询结果是官方公布价的3-5折</p>
            </div>
            <div class="ssjsq">
            	<div class="jsqleft">
                	<table>
                    	<tr>
                        	<td class="ssl">目的国家：</td>
                            <td>
                                <div class="guojiabox">
                                    <div class="guyojiatext"><?= $this->formText('cityName',$this->city->Name,array('readonly'=>true,'cid'=>$this->city->Id)) ?><a href="#"></a></div>
                                    <div class="guojiaceng" style="display:none">
                        <div class="remen">
                        	<h2>热门国家和地区</h2>
                            <ul class="countrylist">
                            	<li><a href="#" id="c_us" cid="1">美国</a></li>
                            	<li><a href="#" cid="2">加拿大</a></li>
                            	<li><a href="#" cid="3">澳大利亚</a></li>
                            	<li><a href="#" cid="47">日本</a></li>
                            	<li><a href="#" cid="39">台湾</a></li>
                            	<li><a href="#" cid="4">新西兰</a></li>
                            	<li><a href="#" cid="5">英国</a></li>
                            	<li><a href="#" cid="42">马来西亚</a></li>
                            </ul>
                        </div>
                        <div class="allcountry">
                        	<h2>全部国家和地区</h2>
                        	<ul class="countryzm">
                                <?php
                                foreach ($this->words as $char){
                                ?>
                                <li <?= $char=='A'?'class="zmon"':'' ?>><a href="#"><?= $char ?></a></li>
                                <?php }
                                ?>
                            	
                            </ul>
                            <div id="countryTab">
                            <?php
                            foreach ($this->words as $char){
                            ?>
                           <ul class="countrylist"  <?= $char=='A'?'':'style="display:none"' ?>>
                            <?php
                               $citys= Application_Model_city::GetBySortCode($char);
                               foreach ($citys as $city){
                               ?>
                            	<li><a href="#" cid="<?= $city->Id ?>"><?= $city->Name ?></a></li>
                                <?php } ?>
                            </ul>
                            <?php
                                }
                            ?>
                            </div>
                        </div>
                    </div>
                                </div>                            
                            
                            </td>
                        </tr>
                    	<tr>
                       	  <td class="ssl">货物重量：</td>
                          <td><input class="text120" name="weight" id="weight" type="text" /><em class="dw">kg</em></td>
                        </tr>
                    	<tr>
                       	  <td class="ssl">包裹尺寸：</td>
                      <td>
                            	<div class="tiji">
                                    <input class="text50" name="length" id="length" type="text" /><i>X</i><input class="text50" name="width" id="width" type="text" /><i>X</i><input class="text50" name="hight" id="height" type="text" /><em class="dw">cm</em><p>(用于计算体积重量，可不填)</p>
                                </div>
                            </td>
                        </tr>
                    </table>
                    
                    <div class="tijiao">
                    	<a href="javascript:void(0)" id="cult">开始试算</a>
                    </div>
                    <div class="ssts"><p><i></i>提示：重量越重价格越优惠 </p></div>
                </div>
                
                <div class="ssright">
                	<div class="bannerpic">
                        <ul class="gglist">
                            <li class="gg1">
                                <h2>悠奇代购服务</h2>
                                <p>为海外华人代购中国商品，免手续费</p>
                                <a href="/purchase/index">立即查看</a>
                            </li>
                        </ul>
                       
                    </div>
                </div>
            </div>
            <div class="jiantou"></div>
        </div>
        <div class="ssjieguo" style="display:none">
        	<div class="jgtop">
                <h2>以下为运送到<em>澳大利亚(AUSTRALIA)</em>的试算结果</h2><p><span>重量：20kg</span><span>尺寸：10*10*10cm</span></p>
            </div>
        	<div class="biao">
            	
            	
            </div>
        
        </div>
        
        <div class="yfb">
        	<div class="yfbtop">
            	<h2><i></i>显示您IP所在地<span>"<?= $this->city->Name ?>"</span>的运费报价</h2>
            </div>
        	<div class="yfbiao">
                <p style="margin-left:40px;color:#999">计算方法（以用<?= $this->prices[0]->Express->Name ?>发送 7KG 包裹到<?= $this->city->Name ?>为例）：<?= $this->prices[0]->FirstPrice?>(首重价) + <?= $this->prices[0]->Price5 ?>（续重价） X 13（续重个数）= <?= number_format($this->prices[0]->FirstPrice + $this->prices[0]->Price5 *13,2)?>元 </p>
                <p>&nbsp;</p>
                <?php
                $air = NULL;
                foreach($this->prices as $item){
                    if($item->Express->IsDisable)
                        continue;
//                    if($item->Express->IsSpecific)
//                        continue;
                    if($item->Express->FirstWeight == 100){ ?>
                        <div class="bbj">
                            <h3><?= $item->Express->Name ?>运费报价 (递送时间:<?= $item->times ?>工作日)
                            </h3>
                            <div class="bleft">
                                <table>
                                    <tr>
                                        <th class="s2">价格区域</th>
                                        <th>首重0.1kg</th>
                                        <th>每续重0.1kg</th>
                                    </tr>
                                    <tr>
                                        <td class="s2">每0.1kg报价</td>
                                        <td>￥<?= $item->FirstPrice ?></td>
                                        <td>￥<?= $item->SubsequentPrice ?></td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <?
                    }else{
                ?>
            	<div class="bbj">
                    <h3><?= $item->Express->Name ?>运费报价 (递送时间:<?= $item->times ?>工作日)</h3>
                	<div class="bleft">
                        <table>
                            <tr>
                                <th class="s2">价格区域</th>
                                <th>首重0.5kg</th>
                                <th>1kg以上续重</th>
                                <th>6kg以上续重</th>
                                <th>11kg以上续重</th>
                                <th>21kg以上续重</th>
                                <th>41kg以上续重</th>
                                <th>71kg以上续重</th>
                            </tr>
                            <tr>
                                <td class="s2">每500g续重价</td>
                                <td>￥<?= $item->FirstPrice ?></td>
                                <td>￥<?= $item->SubsequentPrice ?></td>
                                <td>￥<?= $item->Price5 ?></td>
                                <td>￥<?= $item->Price10 ?></td>
                                <td>￥<?= $item->Price20 ?></td>
                                <td>￥<?= $item->Price40 ?></td>
                                <td>￥<?= $item->Price70 ?></td>
                            </tr>
                        </table>
                    </div>
                </div>
                
                    <?php   
                } 
                }
                 ?>
        </div>
    </div>
   
</div>
</div>
<script type="text/javascript">
$(function(){
    $('.guojiabox').hover(function(){
       
    },function(){
        $('.guojiaceng').hide();
    }).click(function(){
         $('.guojiaceng').show();
        _gaq.push(['_trackEvent', '运费计算', '打开选择', 'shipfee']);
    });
    
    $('.countrylist a').bind('click',function(){
        var city =$(this).text();
        _gaq.push(['_trackEvent', '运费计算', '点击国家', city]);
        $('#cityName').val(city);
        $('#cityName').attr('cid', $(this).attr('cid'));
        $('.guojiaceng').hide();
        $('.ssjieguo').hide();
        $('.yfbtop h2').html('<i></i>正在获取<span>'+ city +'</span>的运费报价，请稍候...' );
        $.post('/tool/expressdetail', {'cityId':$(this).attr('cid')}, function(html){
            $('.yfbtop h2').html('<i></i><span>'+ city +'</span>的运费报价' );
            $('.yfbiao').html(html);
        }, 'html');
        return false;
    });
    $('.countryzm a').each(function(index,item){
        $(item).click(function(){
            _gaq.push(['_trackEvent', '运费计算', '选择字母', $(item).text()]);
            $('.countryzm li.zmon').removeClass('zmon');
            $(this).parent().addClass('zmon');
            $('#countryTab ul').hide();
            $('#countryTab ul').eq(index).show();
            return false;
        });
    });
    $('#cult').click(function(){
        if($('#weight').val()==''){
            alert('请输入货物重量！');
            $('#weight').focus();
            return false;
        }
        post={};
        var input = ['weight','length','width','height'];
        for(var i=0;i<input.length;i++){
            if($('#'+input[i]).val()=='')
                continue;
            if(!/^\d+\.?\d*$/.test($('#'+input[i]).val())){
                alert(input[i]+'对不起，请输入正确的数字！');
                $('#'+input[i]).focus();
                return false
            }
            post[input[i]]=$('#'+input[i]).val();
        }
        post['city'] = $('#cityName').attr('cid');
        $('#cult').text('正在试算...');
        $('.ssjieguo').show().html('<div class="loading"><h4><img src="/images/share/032.gif" alt="正在为您计算价格..."></h4><p>正在为您计算运费价格...</p></div>');
        $.post('/tool/expresscult', post, function(data){
            $('#cult').text('开始试算');
            $('.ssjieguo').html(data);
        }, 'html');
    });
});    
</script>